package com.atlin.project.model.vo.sysAnnouncement;

import com.atlin.project.model.domain.SysAnnouncement;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * 公告VO
 */
@Data
public class SysAnnouncementVO implements Serializable {
    /**
     * id
     */
    private Long id;

    /**
     * 通知标题
     */
    private String title;

    /**
     * 通知内容
     */
    private String content;

    /**
     * 发布人ID
     */
    private Long userId;

    /**
     * 状态 0 - 正常 1 - 过期
     */
    private Integer status;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;


    /**
     * 包装类转对象
     *
     * @param sysAnnouncementVO
     * @return
     */
    public static SysAnnouncement voToObj(SysAnnouncementVO sysAnnouncementVO) {
        if (sysAnnouncementVO == null) {
            return null;
        }
        SysAnnouncement sysAnnouncement = new SysAnnouncement();
        BeanUtils.copyProperties(sysAnnouncementVO, sysAnnouncement);

        return sysAnnouncement;
    }


    /**
     * 对象转包装类
     *
     * @param sysAnnouncement
     * @return
     */
    public static SysAnnouncementVO objToVo(SysAnnouncement sysAnnouncement) {
        if (sysAnnouncement == null) {
            return null;
        }
        SysAnnouncementVO sysAnnouncementVO = new SysAnnouncementVO();
        BeanUtils.copyProperties(sysAnnouncement, sysAnnouncementVO);

        return sysAnnouncementVO;
    }

    private static final long serialVersionUID = 1L;
}